<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

class Welcome extends CI_Controller {
	public function __construct(){
		parent::__construct();
		if($this->auth->is_logged_in() == false){
			redirect('c=c_login','refresh');
		}
	}
	/**
	 * Index Page for this controller.
	 *
	 * Maps to the following URL
	 * 		http://example.com/index.php/welcome
	 *	- or -  
	 * 		http://example.com/index.php/welcome/index
	 *	- or -
	 * Since this controller is set as the default controller in 
	 * config/routes.php, it's displayed at http://example.com/
	 *
	 * So any other public methods not prefixed with an underscore will
	 * map to /index.php/welcome/<method_name>
	 * @see http://codeigniter.com/user_guide/general/urls.html
	 */
	public function index(){
		// Write to $header
		$this->template->write('title', PROJECT_NAME);
		
		$data_sidebar["menus"] = $this->m_public_function->get_menus();
		$this->template->write_view('sidebar', 'sidebar', $data_sidebar, TRUE);
		//$this->template->write_view('sidebar', 'sidebar');
		
		//$this->template->write_view('content', 'main/v_berita');
		
		// Write to $sidebar
		//$this->template->write('footer', 'Footer');
		
		// Render the template
		$this->template->render();
	}
	
	function logout(){
		if($this->auth->is_logged_in() == true){
			// jika dia memang sudah login, destroy session
			$this->auth->do_logout();
		}
		// larikan ke halaman utama
		redirect('c=welcome', 'refresh');
	}
	
}

/* End of file welcome.php */
/* Location: ./application/controllers/welcome.php */